package com.lehecai.core.type.pstation;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by He Wang on 14-7-22.
 */
public class PstationTaskType extends IntegerBeanLabelItem {

	private static final long serialVersionUID = -763399446123302101L;

	private static final Logger logger = LoggerFactory.getLogger(PstationTaskType.class.getName());
	private static List<PstationTaskType> items = new ArrayList<PstationTaskType>();
	private static List<PstationTaskType> queryItems = new ArrayList<PstationTaskType>();

	protected PstationTaskType(String name, int value, boolean queryOnly) {
		super(PstationTaskType.class.getName(), name, value);

		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}

	protected PstationTaskType(String name, int value) {
		this(name, value, false);
	}

	public static PstationTaskType getItem(int value){
		try {
			return (PstationTaskType)PstationTaskType.getResult(PstationTaskType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}

	public static List<PstationTaskType> getItems() {
		return items;
	}

	public static List<PstationTaskType> getItemsForQuery() {
		return queryItems;
	}

	public static final PstationTaskType ALL = new PstationTaskType("全部", 0, true);

	public static final PstationTaskType TASK_PLAN_DRAW = new PstationTaskType("开奖任务", 1);
	public static final PstationTaskType TASK_RESET_PLAN_RESULT_STATUS = new PstationTaskType("重置方案开奖状态任务", 2);
    public static final PstationTaskType TASK_RECALCULATE_TREND_DATA = new PstationTaskType("重算走势图数据任务", 3);
    public static final PstationTaskType TASK_DELETE_TREND_DATA = new PstationTaskType("删除走势图数据任务", 4);
	public static final PstationTaskType TASK_RECALCULATE_ANALYSIS_DATA = new PstationTaskType("重算研究数据任务", 5);

	public static final PstationTaskType TASK_FETCH_LOTTERY_DRAW_RESULT_DATA = new PstationTaskType("抓取开奖结果任务",8);
	public static final PstationTaskType TASK_FETCH_DATA_JCZQ_MATCH_RESULT_DATA = new PstationTaskType("竞彩足球开奖结果任务", 9);
}
